﻿




function ErrorPanel() {

    var _I = this;
    _I.elementErrorPanel = $('#pnlMessages');
    _I.elementErrorTitle = $('#txtErrorTitle');
    _I.elementErrorTxtMessege = $('#txtMessages');
    _I.elementPnlError = $('#pnlError');

    this.hiddeMessage = function () {
        if (_I.elementErrorPanel.hasClass('displayBlock')) {
            _I.elementErrorPanel.addClass('displayNone').removeClass('displayBlock');
        }
    };

    this.showMessage = function (title, message) {

        _I.elementErrorPanel.removeClass('displayNone').addClass('displayBlock');

        _I.elementPnlError.removeClass('errorPanelError').addClass('errorPanelMessage');

        _I.elementErrorTitle.html(title);
        _I.elementErrorTxtMessege.html(message);

    };

    this.showError = function (title, message) {
        _I.elementErrorPanel.removeClass('displayNone');
        _I.elementErrorPanel.addClass('displayBlock');

        _I.elementPnlError.removeClass('errorPanelMessage').addClass('errorPanelError');

        _I.elementErrorTitle.html(title);
        _I.elementErrorTxtMessege.html(message);
    };

    this.appendAsterisk = function (controlId) {

        $('#' + controlId).after($('<span class="errorAsterisk" >*</span>').attr('id', controlId + 'asterisk'));
    };

    this.appendAsteriskToJQControl = function (control) {

        control.after($('<span class="errorAsterisk" >*</span>').attr('id', control.attr('id') + 'asterisk'));
    };

    this.removeErrors = function () {
        $('.errorAsterisk').remove();
    };

    this.removeAsterisk = function (controlId) {

        $('#' + controlId + 'asterisk').remove();
    };

    this.removeAsteriskToJQControl = function (control) {

        $('#' + control.attr('id') + 'asterisk').remove();
    };
}








